<template>
  <div class="app-container">
    <!-- 查询 -->
    <tl-list-search ref="search" style="margin:6px 0" :query-param="queryParam" @search="doQuery" :isDisplayDefaultSearch="false" v-if="isHeaderDisplay">
      <template slot="search">
        <el-form-item class="qryItem" label="相关方" style="margin-left:-14px">
          <el-input v-model="queryParam.qry_user" placeholder="请输入工号或姓名"></el-input>
        </el-form-item>
        <el-form-item class="qryItem" label="类别" style="margin-left:-28px">
          <el-select v-model="queryParam.qry_stakeholdercategory" clearable filterable>
            <el-option v-for="item in codeModel.stakeholdercategoryList" :key="item.code" :label="item.name" :value="item.code" clearable />
          </el-select>
        </el-form-item>
        <el-form-item class="qryItem" label="影响程度">
          <el-select v-model="queryParam.qry_stakeholderimpact" clearable filterable>
            <el-option v-for="item in codeModel.stakeholderimpactList" :key="item.code" :label="item.name" :value="item.code" clearable />
          </el-select>
        </el-form-item>
        <el-form-item class="qryItem" label="管理策略">
          <el-select v-model="queryParam.qry_managementstrategy" clearable filterable>
            <el-option v-for="item in codeModel.managementstrategyList" :key="item.code" :label="item.name" :value="item.code" clearable />
          </el-select>
        </el-form-item>
      </template>
    </tl-list-search>
    <!-- 工具栏 -->
    <tl-list-toolbar class="tl-list-toolbar" :refMainTable="$refs.mainTable" currentModuleTableCode="mpmStakeholder/main" :startColumn="3" ref="toolbar" @add="openAddDialog('editForm')" @deleteBatch="doDeleteBatch" @exportExcel="doExportExcel" @columnCustomize="doColumnCustomize" @displaySearch="doDisplaySearch" :disableDeleteBatch="selectedRowKeys.length <= 0" :isDisplayDeleteBatch="false" :isDisplayAdd="false">
      <template slot="left-btn"> </template>
    </tl-list-toolbar>
    <div>
      <!-- 列表选择 -->
      <div class="table-alert-div" ref="selector">
        <el-alert type="success" :closable="false" class="tl-table-alert-info" effect="light">
          <template slot="title">
            已选择&nbsp;<a class="tl-table-alert-info-a1">{{ selectedRowKeys.length }}</a
            >项&nbsp;&nbsp;
            <a class="tl-table-alert-info-a2" @click="doClearSelected">全部清空</a>
          </template>
        </el-alert>
      </div>
      <!--表格渲染-->
      <el-table class="tl-table" ref="mainTable" :height="tableHeight" resizable-key="tableHeight" :resizable-refs="tableResizeRefs" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" @row-dblclick="doRowDbClick" @row-click="doRowClick" row-key="id" border fit :row-class-name="doChangeRowClassName">
        <el-table-column type="index" label="序号" width="55px" align="center"></el-table-column>
        <el-table-column prop="ordercode" label="相关方编号" width="140px" sortable="custom" sort-by="ordercode" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispstakeholdercategory" label="类别" width="80px" sortable="custom" sort-by="stakeholdercategory" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="username" label="姓名" width="90px" sortable="custom" sort-by="username" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="usercode" label="工号" width="90px" sortable="custom" sort-by="usercode" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="projectnum" label="参与项目数量" width="150px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="tasknum" label="负责任务数量" width="150px"  align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispstakeholderimpact" label="影响程度" width="90px" sortable="custom" sort-by="stakeholderimpact" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispmanagementstrategy" label="管理策略" width="100px" sortable="custom" sort-by="managementstrategy" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="orgdeptarray" label="公司/部门" width="320px" sortable="custom" sort-by="orgdeptarray" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="position" label="职位" width="120px" sortable="custom" sort-by="position" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="message" label="工作组名称" width="120px" sortable="custom" sort-by="message" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="grouprole" label="组内角色" width="110px" sortable="custom" sort-by="grouprole" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="phonenumber" label="联系电话" width="120px" sortable="custom" sort-by="phonenumber" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="email" label="邮箱" width="230px" sortable="custom" sort-by="email" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="description" label="备注" min-width="200px" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column label="操作" width="95px" v-slot="scope" fixed="right">
          <el-dropdown trigger="hover">
            <el-button type="text" icon="el-icon-s-operation" style="margin-left:10px">更多<i class="el-icon-arrow-down el-icon--right"></i></el-button>
            <el-dropdown-menu>
              <el-dropdown-item icon="el-icon-view" @click.native="openViewDialog('editForm', scope.row.id)">查看</el-dropdown-item>
              <el-dropdown-item icon="el-icon-edit" :disabled="true">编辑</el-dropdown-item>
              <el-dropdown-item icon="el-icon-delete" :disabled="true">删除</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-table-column>
      </el-table>
      <!-- 列表分页 -->
      <el-row class="pagebar" ref="pager">
        <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"> </el-pagination>
      </el-row>
      <tl-edit ref="editForm" @refresh="doRefresh" :projectinfo="projectinfo"></tl-edit>
    </div>
  </div>
</template>

<script>
/** mixins */
import { mixin_list } from '@tapui/mixins/mixin_list'
/** 子组件 */
import tlEdit from './edit'
/** 工具类 */
import { getAction, putAction, postAction, deleteAction } from '@tapui/utils/http'
export default {
  name: 'mpmStakeholder',
  mixins: [mixin_list],
  components: { tlEdit },
  data() {
    return {
      description: '项目相关方-列表查询',
      urlPrefix: '/mpm/projectStakeholder/',
      url: {
        queryCodeList: '/mpm/projectStakeholder/dataCodeList'
      },
      reduceHeight: 264,
      // 排序参数
      sorterInfo: {
        sidx: '',
        sord: 'desc'
      },
      // 额外查询参数
      queryParam: {
        qry_projectcode: this.projectinfo.projectcode,
        qry_enabled: '1'
      },
      // 表格双击行为，edit为编辑，view为查看
      rowDbClickActionType: 'view'
    }
  },
  // 传入projectinfo
  props: {
    projectinfo: {
      type: Object,
      default: () => {}
    }
  },
  methods: {}
}
</script>

<style lang="scss" scoped>
.app-container {
  margin: 0;
}
</style>
